<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="jt.classic.system.ISystem"%>
<%@ page import="jt.classic.system.object.IObject"%>
<%@ page import="jt.classic.system.workflow.WObject"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>	
<%@ page import="org.limp.mine.StringTool"%>	
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>
<%@ page import="jt.classic.system.wordbook.WordBookUtil" %>	
<%
    String context = jt.classic.system.ISystem.getContextPath();

    String name = StringTool.checkString(request.getAttribute("name"));
    
    List typeList = (List)request.getAttribute("typeList");
    
    String totalData = StringTool.checkString(request.getAttribute("totalData"));
    
    Object[] result = (Object[]) request.getAttribute("result");
	Label label = result != null ? (Label) result[1] : null;
	Controller controller = result != null ? (Controller) result[2] : null;
	String pageNO = result != null ? (String) result[3] : null;
	List resultList = result != null ? (List) result[0] : null;
%>	
<html>
<head>
<title>DMS Searching...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=context %>/app/dms/css/index.css" rel="stylesheet" type="text/css"/>
<link href="<%=context %>/app/dms/css/share.css" rel="stylesheet" type="text/css"/>
<style>
.box1 {
	height: 30px;
	margin-right: 5px;
	border: 1px solid #ccc;
	border-bottom-color: #999;
	border-right-color: #999;
	padding: 4px;
	font-size: 14px;
	line-height: 18px;
	font-weight: bold;
	color: #434343;
	ime-mode: auto;
	width:830px;
}

.tb {}
.tb a{COLOR: #3D79AB;}
</style>
<script>
     function download(id){
         document.getElementById('dmsdldfrm').src = '<%=context%>/app/dmsdown.do?method=download&id=' + id;
     }
</script>
<body>
<form name="form1" method="post">	
<div align="center" style="margin-top:10px;"><input type="text" class="box1" name="name" value="<%=name %>"> <input type="button" name="btn" value=" 搜索... " onclick="javascript:window.location.href='<%=context %>/dmssearch?encoding=UTF-8&name=' + document.form1.name.value;"></div> 
<hr/>
<%
   if(typeList != null && !typeList.isEmpty()){
	   StringBuffer typeStr = new StringBuffer();
	   
	   typeStr.append("<a  href=\""+context+"/dmssearch?encoding=UTF-8&name="+name+"\">全部</a>_" + totalData + "条");
	   
	   for(int i=0;i<typeList.size();i++){
		   Map temp = (Map)typeList.get(i);
		   
		   String tp = (String)temp.get("COL_FILETYPE");
		   
		   String tpName = WordBookUtil.getWordBookItemName("fileext", tp);
		   
		   typeStr.append(" | ");
		   
		   typeStr.append("<a href=\""+context+"/dmssearch?encoding=UTF-8&name="+name+"&type="+tp+"\">" + tpName + "</a>_" + temp.get("TL") + "条");
	   }	   
%>
<table align="center" width="910"><tr><td>
<DL class="list_dr">
<DT class=line_t><strong><%=typeStr.toString()%></strong></DT>
<DD class=line_b>
<UL>
<%
if (resultList != null && !resultList.isEmpty()) {
	for (int i = 0; i < resultList.size(); i++) {
		Object[] resultInfo = (Object[]) resultList.get(i);

		String number = (String) resultInfo[0];
		IObject obj = (IObject) resultInfo[1];
		
		List contentList = (List)obj.icontent(obj.iobject().itable("DOC_BVFABRYJMQ"));
		
		Map contentMap = (Map)contentList.get(0);
		
		String docType = WordBookUtil.getWordBookItemName("fileext", (String)contentMap.get("COL_FILETYPE"));
		
		String docSize = (String)contentMap.get("COL_FILESIZE");
%>
<LI <%if(i < resultList.size() - 1){ %>style="BORDER-BOTTOM: #4d5b66 1px dashed;"<%} %>><font color="#434343">[<%=docType %>] <a href="javascript:void(0);" onclick="javascript:download('<%=obj.id() %>');" class="doc"><%=obj.iname() %></a>&nbsp;&nbsp; 大小: <%=docSize%> KB, 创建人: <%=obj.icreatorname() %>, 创建时间: <%=DateTrimmer.getYMD_LBL(obj.icreatetime()) %></font></LI>
<%
	}
}	
%>
</UL>
</DD>
</DL>
</td></tr>
<tr>
   <td>
   <table align="center" width="100%" class="tb" style="color:#3a4954;" border="0"
	cellspacing="0" cellpadding="0">
	<tr>
		<td width="50%"><%=label != null ? label.displayLabel() : ""%></td>
		<td align="right">&nbsp;<%=label != null ? label.startLabel() : ""%> <%=label != null ? label.previousLabel() : ""%>
		<%=label != null ? label.nextLabel() : ""%> <%=label != null ? label.endLabel() : ""%> <%=controller != null ? controller.getController().toString() : ""%>
		</td>
	</tr>
</table>
   </td>
</tr>
<tr>
   <td>&nbsp;</td>
</tr>   
</table>
<%
   }   
%>
</form>
<%=controller != null ? controller.getControlScript(true) : ""%>
<iframe width="0" height="0" name="dmsdldfrm" id="dmsdldfrm" src="about:blank"></iframe>
</body>
</html>